import { initGlobalState } from "qiankun";

const state = {
  token: "",
};

// 初始化全局状态
const actions: any = initGlobalState(state);

// 监听状态的变化，然后更新状态
actions.onGlobalStateChange((newState: any) => {
  state.token = newState.token;
});

// 自己定义，读取全局状态的方法
actions.getGlobalState = () => {
  return state;
};

export default actions;
